package com.wjqy.Interceptor;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UserLoginInterceptor implements HandlerInterceptor {

    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Object userid = request.getSession().getAttribute("userid");
        if (userid!=null){
            return true;
        }else {
            response.sendRedirect("/static/login.html");
            return false;
        }
    }

}
